package com.wenwen.social.controller.vo;

import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class ResultVO<T> {
	private Integer code;
	private T data;
	private String msg;

	public static <T> ResultVO success(T data) {
		ResultVO<T> tResultVO = new ResultVO<T>();
		tResultVO.code = 200;
		tResultVO.data = data;
		tResultVO.msg = "success";
		return tResultVO;
	}

	public static <T> ResultVO fail(String msg) {
		ResultVO<T> tResultVO = new ResultVO<T>();
		tResultVO.code = 200;
		tResultVO.msg = msg;
		return tResultVO;
	}

	public static <T> ResultVO fail() {
		ResultVO<T> tResultVO = new ResultVO<T>();
		tResultVO.code = 500;
		tResultVO.msg = "请求失败";
		return tResultVO;
	}
	public static <T> ResultVO fail(Integer code,String msg) {
		ResultVO<T> tResultVO = new ResultVO<T>();
		tResultVO.code = code;
		tResultVO.msg = msg;
		return tResultVO;
	}
}
